#pragma once
//============================================================================
// Copyright (C) 2008-2013 Brett R. Jones 
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses 
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================

#include "VxSktUdp.h"

class VxSktUdpBroadcast : public VxSktUdp
{
public:
	//=== constructor ===//
	VxSktUdpBroadcast();
	//=== destructor ===//
	virtual ~VxSktUdpBroadcast();

	//! startup broadcast socket.. if pBroadcastIp is null
	//! then will broadcast to 255.255.255.255 
	virtual RCODE UdpBroadcastOpen(	VxInetAddress& oIpAddr,
									U16 u16Port = 12345,			// port to listen on
									const char * pBroadcastIp = "255.255.255.255" ); // broadcast to address

	//! broadcast data 
	virtual RCODE BroadcastData(	const char *	pData,			// data to send
									int				iDataLen,		// data length
									U16				u16Port = 0 );	// port to send to ( if 0 then port specified when opened )

	//=== vars ===//
	std::string			m_strBroadcastIp;	// ip to broadcast to in dotted form
    VxInetAddress		m_oBroadcastIp;     // ip to broadcast to in host ordered binary form
};



